package com.quanyue.haircut.shop.mapper;

import com.quanyue.haircut.domain.entity.Technician;
import com.quanyue.haircut.shop.dto.TechnicianServerList;
import com.vhuomai.mybatis.mapper.auto.AutoMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TechnicianMapper extends AutoMapper <Technician, Integer> {
    List <Technician> findByShopValid(@Param("shopId") Integer shopId);

    @Select(" select t.id as technician_server_id,t.reserve_price,s.server_name,t.server"
            + " from qy_technician_server t"
            + " left join qy_shop_server s on s.id = t.server"
            + " where t.technician_id = #{technicianId}")
    List <TechnicianServerList> findTechnicianDetail(@Param("technicianId") Integer technicianId);

    @Select(" select t.*"
            + " from qy_technician_server s"
            + " inner join qy_technician t on s.technician_id = t.id"
            + " where s.server = #{serverId}")
    List <Technician> findByServer(@Param("serverId") Integer serverId);
}
